#ifndef __BSP_LCD_H_
#define __BSP_LCD_H_
#include "gd32f4xx.h"

/***************************************************************************
* LCD_R3 -> PB0
* LCD_R4 -> PA11
* LCD_R5 -> PA12
* LCD_R6 -> PA8
* LCD_R7 -> PG6
*
* LCD_G2 -> PA6
* LCD_G3 -> PG10
* LCD_G4 -> PB10
* LCD_G5 -> PB11
* LCD_G6 -> PC7
* LCD_G7 -> PD3
*
* LCD_B3 -> PG11
* LCD_B4 -> PG12
* LCD_B5 -> PA3
* LCD_B6 -> PB8
* LCD_B7 -> PB9
*
* LCD_PCLK -> PG7
* LCD_HSYNC -> PC6
* LCD_VSYNC -> PA4
* LCD_DEN -> PF10
* LCD_BL -> PD12 //普通输出
* LCD_RST -> PD13 //普通输出
* 
**************************************************************************/
extern uint16_t lcd_frame_buf[800][480];
typedef struct{
	uint32_t width;//800
	uint32_t height;//480
	uint32_t hbp;//46 CLK
	uint32_t hfp;//16-210-354 CLK
	uint32_t vbp;//23 CLK
	uint32_t vfp;//7-22-147 CLK
	uint32_t hsw;// 1 水平同步宽度
	uint32_t vsw;// 1 垂直同步宽度
	uint32_t ppf;//像素格式
	uint32_t acf1;//像素计算因子
	uint32_t acf2;
	struct{
		uint32_t red;
		uint32_t green;
		uint32_t blue;
		uint32_t alpha;
	}backcolor;//初始化背景颜色
	struct{
		uint32_t red;
		uint32_t green;
		uint32_t blue;
		uint32_t alpha;
	}layer0;//图层0默认参数
	void (*rst)(uint8_t en);
	void (*bl)(uint8_t en);
	void (*delay)(uint32_t ms);
}lcd_rgb_t;
extern lcd_rgb_t lcd_rgb_info;

void bsp_lcd_init(void);
void bsp_lcd_set_point_color(uint16_t sx, uint16_t sy, uint32_t color);
void bsp_lcd_full_color_update(void);
#endif
